﻿using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.Net;
using System.Net.Http;
using System.Web.Http.Filters;
using System.Web.Http.Metadata;
using Medora.Core;

namespace Medora.Web.Filters
{
    public class HandlingExceptionFilterAttribute : ExceptionFilterAttribute
    {
        
        public override void OnException(HttpActionExecutedContext context)
        {
            Logger.WriteLog(context.Exception);
            //context.Response = context.Request.CreateErrorResponse(HttpStatusCode.InternalServerError, "If this error will return, please contact Administartor");
            context.Response = context.Request.CreateErrorResponse(HttpStatusCode.InternalServerError, context.Exception);
        }
    }

    
}